package com.ygroup.eventsystem.samples;

import com.ygroup.eventsystem.EventBus;
import com.ygroup.eventsystem.samples.event.ExtSampleEvent;
import com.ygroup.eventsystem.samples.event.SampleEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        ApplicationContext context=new  ClassPathXmlApplicationContext("applicationContext.xml");
        EventBus bus=context.getBean(EventBus.class);
        SampleEvent event=new SampleEvent("sample message", 1, "sample name");
        ExtSampleEvent exevent=new ExtSampleEvent("ext sample message", 2, "extsample name");
        try{
        bus.publishEvent(event);
        }catch(Exception ex)
        {
            System.out.println("app caught exception");
        }
//        bus.publishEvent(exevent);
        bus.destroy();
    }
}
